package com.tomtop.core.exception;

public enum GlobalExceptionStatus implements ExceptionStatus {

	OK(ExceptionLevel.DEBUG, 200, "ok", "操作成功"),
	FAIL(ExceptionLevel.ERROR, 500, "fail", "操作失败"), 
	UPDATE_REDIS_FAIL(ExceptionLevel.INFO, 550, "", "redis提交事务失败"), 
	PAGE_NOT_FOUND(ExceptionLevel.INFO, 404, "Page Not Found.","请求资源不存在"), 
	DO_REQUEST_WAIT_CACHE_RESULT_TIMEOUT(700, "service request timeout","等待请求结果超时"), 
	DO_REQUEST_DESERIALIZATION_FAIL(701, "service response deserialization fail","发请求，结果集转化为json失败"), 
	USER_NOT_LOGIN(ExceptionLevel.INFO, 800, "user not login","用户未登录"),;

	private String message, cnmsg, goUrl;
	private int code;
	private ExceptionLevel level;

	GlobalExceptionStatus(int code, String message) {
		this.message = message;
		this.code = code;
		this.level = ExceptionLevel.WARN;
	}

	GlobalExceptionStatus(int code, String message, String cnMessage) {
		this(code, message);
		this.cnmsg = cnMessage;
	}

	GlobalExceptionStatus(int code, String message, String cnMessage, String goUrl) {
		this(code, message, cnMessage);
		this.goUrl = goUrl;
	}

	GlobalExceptionStatus(ExceptionLevel level, int code, String message) {
		this.message = message;
		this.code = code;
		this.level = level;
	}

	GlobalExceptionStatus(ExceptionLevel level, int code, String message, String cnMessage) {
		this(level, code, message);
		this.cnmsg = cnMessage;
	}

	GlobalExceptionStatus(ExceptionLevel level, int code, String message, String cnMessage, String goUrl) {
		this(level, code, message, cnMessage);
		this.goUrl = goUrl;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getGoUrl() {
		return goUrl;
	}

	public void setGoUrl(String goUrl) {
		this.goUrl = goUrl;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public ExceptionLevel getLevel() {
		return level;
	}

	public void setLevel(ExceptionLevel level) {
		this.level = level;
	}

	public String getCnmsg() {
		return cnmsg;
	}

	public void setCnmsg(String cnmsg) {
		this.cnmsg = cnmsg;
	}
}
